package com.xgp.labblog.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.ArrayList;

@Controller
public class aboutController {

    @Value("${labblog.client.about}")
    String about;

    @GetMapping("/about")
    public String about(Model model) {
        try {

            String s = "";
            char[] arr = about.toCharArray();
            for (char c : arr) {
                if(c == '【') {
                    s = s + "~" + c;
                }else if(c == '】') {
                    s = s + c + "~";
                } else {
                    s = s + c;
                }
            }
            String[] str = s.split("~");

            ArrayList<String> strings = new ArrayList<>();
            for (String s1 : str) {
                strings.add(s1);
            }
//        System.out.println(strings);
            model.addAttribute("abouts",strings);
            return "html/about";
        }catch (Exception e) {
            return "error/4xx";
        }

    }
}
